// vue.config.js
// const Timestamp = new Date().getTime();
module.exports = {
  publicPath: '/',
  outputDir: process.env.VUE_APP_PACK_NAME,
  assetsDir: 'static',
  lintOnSave: false,
  pluginOptions: {
  },
  configureWebpack: { // webpack 配置
    devtool: 'source-map',
  },
  productionSourceMap: false,
  devServer: {
    host: '0.0.0.0',
    port: 8081,
    https: false,
    proxy: {
      '/': {
        // 目标接口域名
        target: process.env.VUE_APP_BASE_API, //默认开发环境 80
        // 以下解决https 访问问题。上面的可以访问http
        changeOrigin: true,
        secure: false,
        // webSocket  businessFlow
        ws: true,
        // 突破host和origin的限制
        headers: {
          referer: process.env.VUE_APP_BASE_API,
          origin: process.env.VUE_APP_BASE_API
        }
      },
    },

  },
  css: {
    loaderOptions: {
      // 给 sass-loader 传递选项
      scss: {
        prependData: `@import "~@/assets/css/_variable.scss";`
      },
    }
  },

  chainWebpack: (config) => {
    config.module
      .rule('worker')
      .test(/\.worker\.js$/)
      .use('worker-loader').loader('worker-loader')
      .options({
        inline: true,
        fallback: false
      }).end();
  }
};
